<template>
  <div>
    用户名: <input @keydown.enter="fn1" type="text" /> <br />
    密&emsp;码: <input @keyup.esc="fn2" type="password" />
  </div>
</template>

<script>
export default {
  methods: {
    fn1() {
      console.log(1);
    },
    fn2() {
      console.log(2);
    },
  },
};
</script>

<style lang="scss" scoped>
</style>